import bus from '@/bus'
import { renderButton } from '@/util';
let data = {
	status: 'pass',
	totalItem: 1,
	pageSize: window.$pageSize,
	currentPage: 1,
	columns: [{
		title: '用户名',
		key: 'userName',
		align: 'left',
    minWidth: 150
	}, {
		title: '姓名',
		key: 'real_name',
		align: 'left',
    minWidth: 200
	}, {
		title: '昵称',
		key: 'nickName',
		align: 'left',
    minWidth: 150
	}, {
		title: '等级',
		key: 'level',
		align: 'left',
    minWidth: 150,
		render: (h, params) => {
			const list = {
				'1': '普通公司',
				'2': 'vip公司',
				'3': '自营公司'
			}
			return h('div', list[params.row.level] || '普通公司')
		}
	}, {
		title: '公司名称',
		key: 'company_name',
		align: 'left',
    minWidth: 200
	}, {
		title: '过期时间',
		key: 'is_time_limit',
		align: 'left',
		minWidth: 200,
		render: (h, params) => {
			let text = '不限制'
			if (params.row.is_time_limit === 0) text = params.row.expire_time
			return h('div', text)
		}
	}, {
		title: '创建时间',
		key: 'creation_time',
		align: 'left',
    minWidth: 200
	}, {
		title: '职业类型',
		key: 'params.row.',
		align: 'left',
    minWidth: 200,
		render: (h, params) => {
      let text = '专职'
      if (params.row.is_profession == 1) text = "兼职"
			return (
				<div>
					{text}
				</div>
			)
		}
  },
  {
		title: '职业',
		key: 'type',
		align: 'left',
    minWidth: 200,
		render: (h, params) => {
      let list = {
        0: '个人',
        1: '设计师',
        2: '制版师',
        3: '制样师'
      }
      let text = list[params.row.type]
			return (
				<div>
					{text}
				</div>
			)
		}
  },
  {
		title: '审核状态',
		key: 'type',
		align: 'left',
    minWidth: 200,
		render: (h, params) => {
      let list = {
        0: '待审核',
        1: '审核通过',
        2: '审核失败'
      }
      let text = list[params.row.status]
			return (
				<div>
					{text}
				</div>
			)
		}
  },
  {
		title: '是否管理员',
		key: 'type',
		align: 'left',
    minWidth: 150,
		render: (h, params) => {
      let list = {
        0: '否',
        1: '是'
      }
      let text = list[params.row.isAdministrator]
			return (
				<div>
					{text}
				</div>
			)
		}
  },
   {
		title: '操作',
		align: 'right',
		minWidth: 250,
    fixed: "right",
		render: (h, params) => {
			let edit = ''
			// 《信息通过》state =1 《信息拒绝》 state=0 
			if (params.row.status == 1 && params.row.apply_change == 1) {
				edit = renderButton(h, { text: '信息拒绝', type: 'warning',  disabled: params.row.isMaster},
				()=>{ bus.$emit("onReject", { id: params.row.id  })})
			} else if (params.row.status == 0 && params.row.apply_change == 1) {
				edit = renderButton(h, { text: '信息通过', type: 'warning',  disabled: params.row.isMaster,},
				()=>{ bus.$emit("onApply", { id: params.row.id  })})
			}
			return (
				<div>
					{ renderButton(h, { text: '续时', type: 'primary',  disabled: params.row.is_time_limit === 1},
						()=>{ bus.$emit("onEdit", { id: params.row.company_id  })})}
					{ renderButton(h, { text: '等级设置', type: 'default'},
						()=>{ bus.$emit("onSetRank", params.row  )})}
          <dropdown class='more-button-inDropdown ml5' v-show={params.row.apply_change == 1}  transfer={true}>
            <i-button size='small' type='primary'>
                审核
              <icon type='ios-arrow-down'></icon>
            </i-button>
            <dropdownMenu slot='list'>
              <dropdownItem >
                { renderButton(h, { text: '信息拒绝', type: 'warning' }, () => { bus.$emit('onReject', { id: params.row.company_id }) })}
              </dropdownItem>
              <dropdownItem >
                { renderButton(h, { text: '信息通过', type: 'primary' }, () => { bus.$emit('onApply', { id: params.row.company_id }) })}
              </dropdownItem>
            </dropdownMenu>
          </dropdown>
				</div>
			)
		}
	}
],
	data: []
}
export default data